﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Helpers
{
    public class FileHelper
    {
        public static string GetContent(string path, Encoding encoding)
        {
            string result = null;

            StreamReader sr = null;
            try
            {
                sr = new StreamReader(path, encoding);
                result = sr.ReadToEnd();
            }
            finally
            {
                if (sr != null)
                    sr.Close();
            }

            return result;
        }

        public static string GetContent(string path)
        {
            string result = null;

            StreamReader sr = null;
            try
            {
                sr = new StreamReader(path);
                result = sr.ReadToEnd();
            }
            finally
            {
                if (sr != null)
                    sr.Close();
            }

            return result;
        }
    }
}
